<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />

<meta name="viewport"
	content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>客户页面</title>
<link rel="stylesheet" href="layui/css/layui.css">
<!--地址为在线引用地址，请替换自己项目中layui路径-->
<script src="layui/layui.js"></script>
<!--地址为在线引用地址，请替换自己项目中layui路径-->
<script src="js/jquery-3.4.0.min.js"></script>
<script src="js/selectOrder.js"></script>

<style>
.layui-tab-title li {
	display: block;
}

.layui-tab-title {
	float: left;
	width: 200px;
}

.layui-tab-content {
	float: left;
	width: 1000px;
}
</style>
</head>
<body>

	<fieldset class="layui-elem-field layui-field-title"
		style="margin-top: 50px;">
		<legend>客户页面</legend>
	</fieldset>
	<div id="navbar" class="navbar-collapse collapse in" aria-expanded="true" style="position:absolute;top:75px;right:75px">
            <ul class="nav navbar-nav navbar-right">
                <li>
                    <a href="#">&nbsp;<span class="glyphicon glyphicon-user" aria-hidden="true"></span>&nbsp;&nbsp;客户&nbsp;&nbsp;:<span th:text = "${session.userId}"></a>
                	<a href="/Logout" style="margin-left:10px;font-size:20px;">退出</a>
                </li>
              

              
            </ul>
        </div>
	<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
		<ul class="layui-tab-title">
			<li class="layui-this">首页</li>
			<li >客户下单</li>
			<li >查询订单</li>
		

		</ul>
		<div class="layui-tab-content" style="height: 100px;">
			<!-- 首页 -->
	    	<div class="layui-tab-item layui-show">欢迎来到客户首页</div>
			<!--客户下单-->
			<div class="layui-tab-item">

				<div style="margin-left: auto; margin-right: auto; width: 300px; height: 400px;">
					<span>订单号：</span><input id="C"><br>
					<span>型号A：</span><input id="A"><span>辆</span><br> 
					<span>型号B：</span><input id="B"><span>辆</span><br>
					<button style="margin-left: 120px" id="btnOrder">下单</button>
				</div>
			</div>
	
			<!--查询订单-->
			<div class="layui-tab-item">
				<table class="layui-hide" id="selectOrder" lay-filter="selectOrder"></table>
			</div>
	
		</div>
	</div>

	<!-- <!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
	<script>
		layui.use('element', function() {
			var $ = layui.jquery, element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
		})
	</script>
	<script>
	layui.use(['laypage'], function(){
  		
  		  layer = layui.layer; //弹层
		$("#btnOrder").on("click",function(){
			var A_num=$("#A").val();
			var B_num=$("#B").val();
			var order_id=$("#C").val();
			console.log(A_num)
			$.ajax({
				type:"post",
             
              url: "/insertOrder",
      	      dataType:"json",
    		
              data: {
            	  "A_num":A_num,
            	  "B_num":B_num,
            	  "order_id":order_id
                    },
                    success:function(data){
                    	console.log(data);
                    	if(data.msg=="ok"){
                    		alert("下单成功");
                    	}else{
                    		alert("错误1");
                    	}
                   		
                    	 
						
					},
					error:function(){
						alert("失败");
						
					}
                   
			})
		})
	})
	</script>




</body>
</html>
